#pragma once
#include <windows.h>

class PipeMessage
{
public:
	enum MessageType
	{
		LOGIN,
		REDIRECT,
		DISCONNECT,
		JOIN_GAME,
		START_GAME,
		GAME_OVER,
		ABANDON_GAME,
		COUNTDOWN,
		PUNISHING,
		PUNISH_STOP,
		CREATE_USER,
		TOP10,
		GAME_STATS,
		DROPPED_TILE,
		LOCK_BAG_TILE,
		LOCK_BAG_TILE_AUTH,
		UNLOCK_BAG_TILE,
		LOCK_BOARD_LINE,
		PLACE_BAG_LETTER,
		PLACE_BOARD_LETTER,
		REMOVE_BOARD_LETTER,
		PLACE_BOARD_LETTER_AUTH
	};

protected:

	bool mBufferChanged;
	MessageType mType;
	BYTE* mBuffer;

private:
	void UpdateBuffer();

protected:
	virtual UINT GetBufferSize() = 0;
	virtual UINT CreateBuffer(UINT _startPos = 0) = 0;
	virtual void ParseBuffer() = 0;
	

public:
	PipeMessage(MessageType _type);
	~PipeMessage(void);

public:
	UINT GetSize();
	MessageType Type() { return mType; }
	BYTE* Buffer(void);
};

